from django.db import models

# Create your models here.
class User(models.Model):
    mobile=models.CharField('手机号',max_length=200)
    password=models.CharField("密码",max_length=200)
    class Meta:
        db_table='user'
        verbose_name_plural='用户'
    def __str__(self):
        return self.mobile

class LeiBie(models.Model):
    img=models.CharField("图片",max_length=200)
    name=models.CharField("名字",max_length=200)
    user=models.ForeignKey(User,on_delete=models.CASCADE,verbose_name='外键')
    class Meta:
        db_table='leibie'
        verbose_name_plural='类别'
    def __str__(self):
        return self.name

class ShangPin(models.Model):
    img=models.CharField("图片",max_length=200)
    name=models.CharField("名字",max_length=200)
    num=models.CharField("数量",max_length=200)
    price=models.CharField("金额",max_length=200)
    lei=models.ForeignKey(LeiBie,on_delete=models.CASCADE,verbose_name="外键类")
    class Meta:
        db_table='shangpin'
        verbose_name_plural='商品'
    def __str__(self):
        return self.name



